﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AgentBar.Common
{
    public class ResProfile
    {
        //get the server 
        public string Server { get; set; }
        public string Appl { get; set; }
        public string Phase { get; set; }
        public string TenantID { get; set; }
        public string TenantPassword { get; set; }
        public string AgentID { get; set; }

        public string AgentPassword { get; set; }
        //internal num
        public string Logon { get; set; }

        public bool blSoftPhone { get; set; }
        //
        public string UserUrl { get; set; }

        public string Url { get; set; }
        public ResProfile()
        {
            GetResProfile();
        }
        public void GetResProfile()
        {
            string CTe1SubKey = "Software\\NGCPADAPTER";
            Microsoft.Win32.RegistryKey reg = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(CTe1SubKey, false);
            if (reg == null)
            {
                reg = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(CTe1SubKey, false);
            }
            Url = reg.GetValue("Url", "").ToString();
            Server = reg.GetValue("Server", "").ToString();
            Appl = reg.GetValue("Appl", "").ToString();
            Phase = reg.GetValue("Phase", "").ToString();
            TenantID = reg.GetValue("TenantID", "").ToString();
            TenantPassword = reg.GetValue("TenantPass", "").ToString();
            UserUrl = reg.GetValue("UserUrl","").ToString();
            Microsoft.Win32.RegistryKey regAgentSetting = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(CTe1SubKey, false);
            AgentID = regAgentSetting.GetValue("AgentID", "").ToString();
            Logon = regAgentSetting.GetValue("AgentExtension", "").ToString();
            AgentPassword = regAgentSetting.GetValue("AgentPassword","").ToString();
            blSoftPhone = regAgentSetting.GetValue("AgentUseSoftPhone","0").ToString()=="1";
        }
    }
}
